package com.ycg.blog.pojo.vo;

import com.ycg.blog.pojo.Category;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;


import java.util.List;

/**
 * @author YCG
 * @date 2024-03-02 20:00
 * @description 分类页面的视图
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class CategoryVo extends Category {
    /**
     * 该分类下的文章数量
     */
    private Integer count;

    /**
     * 所属子分类列表
     */
    private List<CategoryVo> children;

    public void setCategory(Category category) {
        setId(category.getId());
        setName(category.getName());
        setCreateTime(category.getCreateTime());
        setIsEnd(category.getIsEnd());
        setParentId(category.getParentId());
    }

}
